//////////////////////////////////////////////////////////////////////////
// Method:    JavaEnv
// FullName:  JavaEnv.JavaEnv
// Access:    public 
// Returns:   If you need set java sdk path ,there are only two environment path you should installed
//            One is classpath ,and the other is system path(just because you want compile java in command)
// Parameter: String javaHome
//////////////////////////////////////////////////////////////////////////
using System;

class JavaEnv : Env
{
    public JavaEnv(string javaHome)
    {
        //just want to expand variables
        Environment.SetEnvironmentVariable(@"JAVA_HOME", javaHome, EnvironmentVariableTarget.Machine);
        Console.WriteLine(Environment.ExpandEnvironmentVariables(@"%JAVA_HOME%\bin;"));
    }
    public void SetEnv()
    {
        SetClassPath();
        SetSysPath();
    }
    public void SetSysPath()
    {
        Append(@"PATH", sysPath);
    }
    public void SetClassPath()
    {
        Append(@"classpath", classPath);
    }
    new public string ClassPath()
    {
        return Environment.ExpandEnvironmentVariables(classPath);
    }
    public string SysPath()
    {
        return Environment.ExpandEnvironmentVariables(sysPath);
    }
    ~JavaEnv()
    {
        //delete the java_home path
       // Environment.SetEnvironmentVariable("JAVA_HOME", null);
    }
    private string sysPath = @"%JAVA_HOME%\bin;";
    private string classPath = @"%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;";
};